package com.base.cn.platform.os.controller.integralgood;

import com.base.cn.platform.os.common.controller.BaseController;
import com.base.cn.platform.os.common.mybatis.Pagination;
import com.base.cn.platform.os.common.utils.ObjectUtils;
import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.entity.integralgood.IntegralCardVoucher;
import com.base.cn.platform.os.entity.integralgood.IntegralVirtualGood;
import com.base.cn.platform.os.entity.integralgood.IntegralVirtualGoodExpand;
import com.base.cn.platform.os.service.integralgood.IntegralCardVoucherBiz;
import com.base.cn.platform.os.service.integralgood.IntegralGoodBiz;
import com.base.cn.platform.os.service.integralgood.IntegralVirtualGoodBiz;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 卡密
 * @Author: Hello豆包
 * @Date: 2019/10/18 14:43
 */
@RestController
@RequestMapping("/manage/integralVirtualGood/")
public class IntegralVirtualGoodController extends BaseController {

        @Autowired
        IntegralVirtualGoodBiz integralVirtualGoodBiz;

    /**
     * 获取列表
     * @param currentPage
     * @param integralVirtualGood
     * @return
     */
        @RequestMapping("getPageList")
        public PageInfo<IntegralVirtualGood> getPageList(@RequestParam(value = "currentPage",required = false,defaultValue = "1") int currentPage , @RequestBody IntegralVirtualGood integralVirtualGood ){

            Pagination page = new Pagination();
            page.setCurrentPage(currentPage);
           return  integralVirtualGoodBiz.findListPage(page,integralVirtualGood);
        }


    /**
     * 保存数据
     * @param integralVirtualGood
     * @return
     */
    @RequestMapping("saveEntity")
    public Map  saveEntity(@RequestBody IntegralVirtualGood integralVirtualGood ){

      return ResultUtil.SUCCESS("保存成功");
    }

    /**
     * 根据ID获取对象
     * @param id
     * @return
     */
    @RequestMapping("getById")
    public   IntegralVirtualGood  getById(@RequestParam ("id") BigDecimal id ){
      return   integralVirtualGoodBiz.findById(id);
    }

}
